package edu.sctu.practice.class01.nieyu.assign03.assign03_1_graph;


/**
 * Created by Administrator on 2015/10/22.
 */
public class GeometricObjectClient {

    public static void main(String[] args) {

        System.out.println("圆：");
        GeometricObject circle = new Circle(2);
        System.out.println("圆面积：" + circle.findArea());
        System.out.println("圆周长：" + circle.findPerimeter());
        System.out.println("圆颜色：" + circle.color);
        System.out.println(circle.toString());

        System.out.println("************************");

        System.out.println("矩形：");
        GeometricObject rectangle = new Rectangle(3, 5);
        System.out.println("矩形面积：" + rectangle.findArea());
        System.out.println("矩形周长：" + rectangle.findPerimeter());
        System.out.println("矩形颜色：" + rectangle.color);
        System.out.println(rectangle.equals(rectangle));
        System.out.println(rectangle.toString());

        System.out.println("************************");

        System.out.println("面积相同吗？" + equalArea(circle, rectangle));

        System.out.println("************************");

        displayGeometricObject(circle);
        displayGeometricObject(rectangle);


    }

    static boolean equalArea(GeometricObject circle, GeometricObject rectangle) {

        return circle.findArea() == rectangle.findArea();

    }

    static void displayGeometricObject(GeometricObject object) {

        System.out.println("这是图形的面积：" + object.findArea());
        System.out.println("这是图形的周长：" + object.findPerimeter());
    }
}
